﻿<%@ Page Title="Pedido" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ListaItensPedido.aspx.cs" Inherits="Kakaroto.Pedidos.ListaPedidos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <div id="ItensPedido" runat="server" class="alert alert-danger" role="alert">
    </div>

    <asp:GridView ID="ListaItensPedido" runat="server" AutoGenerateColumns="false" ShowFooter="false" 
        GridLines="Vertical" CellPadding="4" ItemType="Kakaroto.Models.ItemPedido" 
        SelectMethod="GetItensPedido" CssClass="table table-striped table-bordered" >
        <Columns>
            <asp:BoundField DataField="Id_Prod" HeaderText="Id" SortExpression="Id_Prod" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Small" ItemStyle-CssClass="hide" HeaderStyle-CssClass="hide" />
            <asp:BoundField DataField="Produto.Nome" HeaderText="Produto" HeaderStyle-Width="50%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Small" />
            <asp:TemplateField HeaderText="Qtd." HeaderStyle-Width="10%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Small" >
                <ItemTemplate>
                    <asp:TextBox ID="QtddDeProduto" Width="25" runat="server" Text="<%#:Item.Qtdd %>"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Total Parcial" HeaderStyle-Width="10%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Small" >
                <ItemTemplate>
                    <%#:String.Format("{0:c}", ((Convert.ToDouble(Item.Qtdd)) * Convert.ToDouble(Item.Produto.Preco)))%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Observ." HeaderStyle-Width="30%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Smaller" >
                <ItemTemplate>
                    <%#:Item.Observacao%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Excluir" HeaderStyle-Font-Size="Small" HeaderImageUrl="~/Imagens/Icons/delete.png" ItemStyle-Font-Size="Small"> 
                <ItemTemplate>
                    <asp:CheckBox id="Remove" runat="server"></asp:CheckBox>
                </ItemTemplate>        
        </asp:TemplateField>    
        </Columns>
    </asp:GridView>

    <div id="ValTotal" runat="server" class="alert alert-info" role="alert">
        <strong>
            <asp:Label ID="LabelTotalText" runat="server" Text="Valor Total: "></asp:Label>
            <asp:Label ID="lblTotal" runat="server" EnableViewState="false"></asp:Label>
        </strong> 
    </div>

    <div runat="server" style="text-align:left">
        <asp:Button ID="AdicionaItens" runat="server" Text="+ Itens" OnClick="AdicionaBtn_Click" class="btn btn-success" />
        <asp:Button ID="UpdateBtn" runat="server" Text="Atualizar" OnClick="UpdateBtn_Click" class="btn btn-primary" />
        <asp:Button ID="FinalizaBtn" runat="server" Text="Finalizar" OnClick="FinalizaBtn_Click" class="btn btn-danger" />   
    </div>

    <hr />
    <div runat="server" style="text-align:right">
        <asp:Button ID="EsvaziaBtn" runat="server" Text="Limpar Tudo" OnClick="EsvaziaBtn_Click" class="btn btn-default" />
        <asp:Button ID="CancelaBtn" runat="server" Text="Cancelar Pedido" OnClick="CancelaBtn_Click" class="btn btn-default"/>
    </div>

    <br /><br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" ShowFooter="false" 
        GridLines="Vertical" CellPadding="2" ItemType="Kakaroto.Models.ItemPedido" 
        SelectMethod="GetItensEmPreparo" CssClass="table table-condensed table-bordered"
        Caption='<table cellpadding="0" border="1" bordercolor="#CCCCCC" cellspacing="0" width="100%"><tr bgcolor="#F8F8F8"><td><h4>Itens em andamento</h4></td></tr></table>' CaptionAlign="Left" >
        <Columns>
            <asp:TemplateField HeaderText="Qtdd." HeaderStyle-Width="5%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Smaller" >
                <ItemTemplate>
                    <%#:Item.Qtdd%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Produto.Nome" HeaderText="Produto" HeaderStyle-Width="65%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Small" />
            <asp:TemplateField HeaderText="Observ." HeaderStyle-Width="20%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Smaller" >
                <ItemTemplate>
                    <%#:Item.Observacao%>
                </ItemTemplate>
            </asp:TemplateField>       
            <asp:TemplateField HeaderText="Total Parcial" HeaderStyle-Width="10%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Small" >
                <ItemTemplate>
                    <%#:String.Format("{0:c}", ((Convert.ToDouble(Item.Qtdd)) * Convert.ToDouble(Item.Produto.Preco)))%>
                </ItemTemplate>
            </asp:TemplateField>       
        </Columns>
    </asp:GridView>

    <asp:GridView ID="ItemProntos" runat="server" AutoGenerateColumns="false" ShowFooter="false" 
        GridLines="Vertical" CellPadding="2" ItemType="Kakaroto.Models.ItemPedido" 
        SelectMethod="GetItensProntos" CssClass="table table-condensed table-bordered"
        Caption='<table cellpadding="0" border="1" bordercolor="#CCCCCC" cellspacing="0" width="100%"><tr bgcolor="#F8F8F8"><td><h4>Itens entregues</h4></td></tr></table>' CaptionAlign="Left" >
        <Columns>
            <asp:TemplateField HeaderText="Qtdd." HeaderStyle-Width="5%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Smaller" >
                <ItemTemplate>
                    <%#:Item.Qtdd%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Produto.Nome" HeaderText="Produto" HeaderStyle-Width="65%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Small" />
            <asp:TemplateField HeaderText="Observ." HeaderStyle-Width="20%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Smaller" >
                <ItemTemplate>
                    <%#:Item.Observacao%>
                </ItemTemplate>
            </asp:TemplateField>       
            <asp:TemplateField HeaderText="Total Parcial" HeaderStyle-Width="10%" HeaderStyle-Font-Size="Small" ItemStyle-Font-Size="Small" >
                <ItemTemplate>
                    <%#:String.Format("{0:c}", ((Convert.ToDouble(Item.Qtdd)) * Convert.ToDouble(Item.Produto.Preco)))%>
                </ItemTemplate>
            </asp:TemplateField>       
        </Columns>
    </asp:GridView>
</asp:Content>
